//
//  ModelsViewController.m
//  mobilePhoneAssistant
//
//  Created by 方灵勇 on 15/1/26.
//  Copyright (c) 2015年 Fangfang. All rights reserved.
//

#import "ModelsViewController.h"
#import "DetailPage/PieMenuViewController.h"
#import "AFNetworking.h"

@interface ModelsViewController ()



@end

@implementation ModelsViewController

- (void)dealloc
{
    [_dic release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    //调用方法
    [self interfaceLayout];
    [self AnalyticalData];
    // Do any additional setup after loading the view.
}
#warning 布局
- (void)interfaceLayout
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(100, 200, 100, 100);
    [button setTitle:@"dianji" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(alicked:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}

- (void)alicked:(UIButton *)button
{
    PieMenuViewController *pie = [[PieMenuViewController alloc]init];
    pie.menDic = self.dic;
    [self.navigationController pushViewController:pie animated:YES];
    [pie release];
    
}

#warning 解析数据
- (void)AnalyticalData
{
    ModelsViewController *mode = self;
    NSString *str = [[NSString stringWithFormat:@"http://lib3.wap.zol.com.cn/index.php?c=Android_38o_ManuList&subcateId=57&noParam=1&vs=and381"]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    [manager GET:str parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSLog(@"%@",responseObject);
        if ([responseObject isKindOfClass:[NSArray class]]) {
            
        }else{
            mode.dic = responseObject;
        }
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"%@",error);
    }];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
